﻿@model IEnumerable<LotteryVoteMVC.Models.LotteryCompany>
@using LotteryVoteMVC.Models
@using LotteryVoteMVC.Resources
@using LotteryVoteMVC.Utility
@{
    ViewBag.Title = Resource.Roll7;
    Layout = "~/Views/Shared/BetMain.cshtml";
}
@section Head
{
    <script src="@Url.Content("~/Scripts/Customer/BetOrder.js")?v=1.1" type="text/javascript"></script>
}
@{
    Func<GameType, PlayWay, string> BuildWagerInputName = (GameType gt, PlayWay pw) =>
    {
        var gpw = ((IList<GamePlayWay>)ViewBag.GamePlayWays).Find(it => it.GameType == gt && it.PlayWay == pw);
        return string.Format("{0}_{1}_{2}", (int)gt, pw, gpw.Id);
    };
}
<div style="height: *; width: 100%; min-width: 800;">
    <table id="betTable">
        <thead>
            <tr>
                <td style="width: 1.5%" class="gameEnd">
                </td>
                <td style="56px; width: 5.6%" class="gameEnd">
                </td>
                <td colspan="5" style="width: 38.8%" class="gameEnd">
                    2D
                </td>
                <td colspan="5" style="width: 38.8%" class="gameEnd">
                    3D
                </td>
                <td style="width: 10%" class="gameEnd">
                    @foreach (string region in ViewBag.Regions)
                    {
                        <input type="checkbox" id='@region' name='@region' class="region" checked="checked" />
                        <label for='@region'>
                            @region.Substring(0, 1)</label>
                    }
                </td>
                <td style="width: 5.2%">
                </td>
            </tr>
            <tr id="title">
                <td class="gameEnd">
                    @Resource.No
                </td>
                <td class="gameEnd">
                    @Resource.Num
                </td>
                <td>
                    @Resource.Head
                </td>
                <td>
                    @Resource.Last
                </td>
                <td>
                    @Resource.HeadAndLast
                </td>
                <td>
                    @Resource.Roll
                </td>
                <td class="gameEnd">
                    @Resource.Roll7
                </td>
                <td>
                    @Resource.Head
                </td>
                <td>
                    @Resource.Last
                </td>
                <td>
                    @Resource.HeadAndLast
                </td>
                <td>
                    @Resource.Roll
                </td>
                <td class="gameEnd">
                    @Resource.Roll7
                </td>
                <td class="gameEnd">
                    @foreach (var company in Model)
                    {
                        <span class='allCheck_@(company.Region)' style="display:inline-block;">
                            <input id="allCheck_@(company.CompanyId)" name="allCheck_@(company.CompanyId)" type="checkbox"
                                class="allChecked" />
                            <label for='allCheck_@(company.CompanyId)'>
                                @company.Abbreviation</label>
                        </span>
                    }
                </td>
                <td>
                    @Resource.TotalAmount
                </td>
            </tr>
        </thead>
        <tbody>
            @for (int i = 1; i <= 10; i++)
            {
                <tr class="@(i % 2 == 0 ? "" : "odd") @(i == 1 ? "first" : string.Empty)">
                    <td>
                        @i
                    </td>
                    <td class="gameEnd">
                        <input class="num" type="text" rowid='@i' maxlength="5" />
                    </td>
                    <td>
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.Head)_@(i)' type="text" class='wager@(i)' />
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.Head)_@(i)_ck' type="checkbox" />
                    </td>
                    <td>
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.Last)_@(i)' type="text" class='wager@(i)' />
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.Last)_@(i)_ck' type="checkbox" />
                    </td>
                    <td>
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.HeadAndLast)_@(i)' type="text" class='wager@(i)' />
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.HeadAndLast)_@(i)_ck' type="checkbox" />
                    </td>
                    <td>
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.Roll)_@(i)' type="text" class='wager@(i) ' />
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.Roll)_@(i)_ck' type="checkbox" />
                    </td>
                    <td class="gameEnd roll7">
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.Roll7)_@(i)' type="text" class='wager@(i) ' />
                        <input id='@BuildWagerInputName(GameType.TwoDigital, PlayWay.Roll7)_@(i)_ck' type="checkbox" />
                    </td>
                    <td>
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.Head)_@(i)'  type="text" class='wager@(i) ' />
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.Head)_@(i)_ck' type="checkbox" />
                    </td>
                    <td>
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.Last)_@(i)' type="text" class='wager@(i) ' />
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.Last)_@(i)_ck' type="checkbox" />
                    </td>
                    <td>
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.HeadAndLast)_@(i)' type="text" class='wager@(i) ' />
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.HeadAndLast)_@(i)_ck' type="checkbox" />
                    </td>
                    <td>
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.Roll)_@(i)' type="text" class='wager@(i) ' />
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.Roll)_@(i)_ck' type="checkbox" />
                    </td>
                    <td class="gameEnd roll7">
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.Roll7)_@(i)' type="text" class='wager@(i) ' />
                        <input id='@BuildWagerInputName(GameType.ThreeDigital, PlayWay.Roll7)_@(i)_ck' type="checkbox" />
                    </td>
                    <td>
                        @foreach (var company in Model)
                        {
                            <span style="padding-left: 1px; padding-right: 1px; display: inline-block; zoom: 1;">
                                <input name='company@(company.CompanyId + "_" + i)' company='@company.CompanyId'
                                id='company@(company.CompanyId)_@(i) ' type="checkbox" class='company@(i) '
                                region='@company.Region' />
                                <label for='company@(company.CompanyId)_@(i) '>
                                    @company.Abbreviation</label>
                            </span>
                        }
                    </td>
                    <td>
                        <span id='amount@(i)' class="turnover"></span>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
